<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOperationTemplateDatasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 内容模板数据表
        Schema::create('operation_template_datas', function (Blueprint $table) {
            // 引擎
            // $table->engine = 'InnoDB';
            $table->increments('id');
            // 内容模板类型名
            $table->string('template_type', 100)->nullable()->index();
            // 内容模板编号
            $table->string('template_no', 100)->nullable()->index();
            // 服务商
            $table->string('sp_id', 100)->nullable()->index();
            // 频道id
            $table->string('channel_id', 100)->nullable()->index();
            // 终端
            $table->string('terminal', 100)->nullable()->index();
            // 中间件
            $table->string('middleware', 100)->nullable()->index();
            // 内容, 现在存为json
            $table->text('content')->nullable();
            // 起止时间
            $table->timestamp('start_time')->nullable();
            $table->timestamp('end_time')->nullable();
            // 更新, 新建时间
            $table->timestamps();
            // 软删除
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('operation_template_datas');
    }
}
